package com.jin.webvideo.js.stopwatch;

class TimeInfo {
    String name;
    StopwatchThread.TimeoutEvent event;
    long time;
    long startTime;
    TimeInfo(String name, long time, StopwatchThread.TimeoutEvent event){
        this.name = name;
        this.time = time;
        this.event = event;
        startTime = System.currentTimeMillis();
    }
    boolean spend(){
        boolean timeout = System.currentTimeMillis() - startTime > time;
        if (timeout){
            event.accept();
        }
        return timeout;
    }
}